const channelUtility = {
  state: {
    channelUtility: {
      rate_tdm: 0,
      rate_aloha: 0,
      rate_traffic: 0
    }
  },
  mutations: {
    setChannelUtility (state, data) {
      state.channelUtility.rate_tdm = data.rate_tdm / 10
      state.channelUtility.rate_aloha = data.rate_aloha / 10
      state.channelUtility.rate_traffic = data.rate_traffic / 10
    }
  },
  actions: {
    async getChannelUtility (context) {
      let response = await context.dispatch('axios', {
        method: 'get',
        url: '/api/abs/ncp/channel_utility/'
      })
      context.commit('setChannelUtility', response.data)
    }
  }
}
export default channelUtility
